Padovan Sequence
Padovan Sequence similar to Fibonacci sequence with similar recursive structure. The recursive formula is,...
read more
Recursively break a number in 3 parts to get maximum sum
Given a number n, we can divide it in only three parts n/2, n/3 and n/4 (we will consider only integer part). The task is to find the maximum sum we can make by dividing number in three parts recursively and summing up them together.Examples:...
read more
Find all combinations of k-bit numbers with n bits set where 1 <= n <= k in sorted order
Given a number k, find all the possible combinations of k-bit numbers with n-bits set where 1 <= n <= k. The solution should print all numbers with one set bit first, followed by numbers with two bits set,.. up to the numbers whose all k-bits are set. If two numbers have the same number of set bits, then smaller number should come first. Examples:...
read more
Count number of ways to fill a “n x 4” grid using “1 x 4” tiles
Given a number n, count number of ways to fill a n x 4 grid using 1 x 4 tiles.Examples:...
read more
Walmart Labs Interview Experience | Set 2 (On-Campus)
1st round (Written Test)...
read more
Number of ways such that only K bars are visible from the left
Given a number K, and N bars of height from 1 to N, the task is to find the number of ways to arrange the N bars such that only K bars are visible from the left....
read more
Length of the longest valid substring
Given a string consisting of opening and closing parenthesis, find the length of the longest valid parenthesis substring....
read more
Distinct palindromic sub-strings of the given string using Dynamic Programming
Given a string str of lowercase alphabets, the task is to find all distinct palindromic sub-strings of the given string....
read more
Count of Palindromic substrings in an Index range
Given a string str of small alphabetic characters other than this we will be given many substrings of this string in form of index tuples. We need to find out the count of the palindromic substrings in given substring range....
read more
Minimize remaining array element by removing pairs and replacing them by their absolute difference
Given an array arr[] consisting of N positive integers, the task is to minimize the remaining array element that can be obtained by repeatedly removing a pair of array elements and replacing them by their absolute difference....
read more
Count of paths in given Binary Tree with odd bitwise AND for Q queries
Given an integer Q representing the number of queries and an array where each query has an integer N. Our task is to iterate through each query and find the number of paths such that bitwise AND of all nodes on that path is odd....
read more
Maximize trailing zeros in product from top left to bottom right of given Matrix
Given a matrix mat[][] of dimensions N * M, the task is to print the maximum number of trailing zeros that can be obtained in the product of matrix elements in the path from the top-left cell (0, 0) to the bottom-right cell (N – 1, M – 1) of the given matrix. Only possible moves from any cell (i, j) is (i + 1, j) or (i, j + 1)....
read more